<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>歌曲自定义代码</title>
    </head>
    <body>
    <div id="container"></div>
    <div id="control"></div>
    </body>
    <script src='icreate.js'></script>
    <script>
    var musices=[];
    for(var i=0;i<10;i++){
    	musices.push('歌曲'+(i+1));
    }

    new F("#container")[0].innerHTML=F.map(musices,function(v,i){
    		return '<input type="checkbox" />'+ v + '<br/>';
    }).join('');


    // 创建 按钮
    var btns=[
		{name:'全选',id:'all'},
		{name:'全不选',id:'no'},
		{name:'反选',id:'fan'}
    ];

    new F('#control')[0].innerHTML = F.map(btns,function(v,i){
    	return '<input type="button" value="'+v.name+'" id="'+v.id+'">';
    }).join('');
   // 添加事件

    new F('#all')[0].onclick =function(){
    	new F('#container input').each(function(){
    		this.checked = true;
    	});
    };

    new F("#no")[0].onclick =function(){
    	new F('#container input').each(function(){
    		this.checked=false;
    	});
    };

    new F('#fan')[0].onclick =function(){
    	new F('#container input').each(function(){
    		this.checked= !this.checked;
    	});
    };
    
    

    </script>
</html>